package com.netcracker.studportal.server.main_test;

import org.json.simple.JSONObject;

import com.netcracker.studportal.server.facade.FacadeProfessor;
import com.netcracker.studportal.server.model.Exam;
import com.netcracker.studportal.server.model.ExamWithResult;
import com.netcracker.studportal.server.model.Material;
import com.netcracker.studportal.server.model.Professor;

public class MainFacadeProfessor {
	
	public static void main(String args[]){
		FacadeProfessor fp = new FacadeProfessor();
		
		try{
			JSONObject obj = new JSONObject();
			
			ExamWithResult ex_res = new ExamWithResult();
			ex_res.setExam_id(new Long(5));
			ex_res.setStudent_id(new Long(9));
			ex_res.setMark(3);
			ex_res.setNote("Asshole");
			//fp.setExamResultByStudent(ex.kJSON().toString());
			
			Professor pr = new Professor();
			pr.setId(new Long(5));	
			//System.out.println(fp.getSheduleExamsByProfessor(pr.kJSON().toString()));
			
			Exam ex = new Exam();
			ex.setId(new Long(7));
			//System.out.println(fp.getExamResultsByID(ex.kJSON().toString()));
			//System.out.println(fp.getMaterialsByExam(ex.kJSON().toString()));
			//System.out.println(fp.deleteMaterialsByExam(ex.kJSON().toString()));
			
			//test for addMaterialByExam()
			obj.put("exam_id", new Long(7));
			obj.put("material_name", new String("pulp fiction.txt"));
			obj.put("path", new String("C:/a/1.txt"));
		//	String str = fp.addMaterialByExam(obj.toString());
		//	System.out.println("ress" + str);
			
			Material m = new Material();
			m.setId(new Long(27));
			//System.out.println(fp.deleteMaterialByID(m.kJSON().toString()));
			
			
			JSONObject obj1 = new JSONObject();
			
			obj1.put("exam_id", "7");
			//String str1=fp.loadMaterialByID(obj1.toString());
		    //String str1=fp.deleteMaterialByID(obj1.toString());
			String str1=fp.deleteMaterialsByExam(obj1.toString());
			System.out.println("str "+str1);
					
		}catch(Exception e){
			e.printStackTrace();
		}
	}
}
